package com.winter.Controller;

import com.winter.model.FinDepositReceipt;
import com.winter.service.FinDepositReceiptService;
import com.winter.util.Result;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("v1/finDepositReceipt")
public class FinDepositReceiptController {


    @Autowired
    private FinDepositReceiptService finDepositReceiptService;

    /**
     * 存单列表
     */
    @GetMapping
    public Result list(Integer pageSize, Integer pageNumber, String direct, String rating, String deadline, String rate, String userNo, String sortName, String sort, String key) {

        return finDepositReceiptService.list(pageSize, pageNumber, direct, rating, deadline, rate, userNo,sortName,sort, key);
    }

    /**
     * 新增存单
     */
    @PostMapping
    public Result insert(@RequestBody FinDepositReceipt finDepositReceipt) {
        return finDepositReceiptService.insert(finDepositReceipt);
    }

    @GetMapping("detail")
    public Result details(Long id, String userNo) {
        return finDepositReceiptService.details(id, userNo);
    }

    @PutMapping
    public Result update(@RequestBody FinDepositReceipt finDepositReceipt) {
        return finDepositReceiptService.update(finDepositReceipt);
    }
}
